package com.undsf.chaldea.entities

import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonNaming
import com.undsf.chaldea.util.ServantClass

/**
 * Created by Arathi on 2017/8/22.
 */
data class ServantMetadata (
        var id: Int
) {
    // 基础数据
    var name: String? = null

    @JsonProperty("name_cn")
    var nameChinese: String? = null

    @JsonProperty("name_en")
    var nameEnglish: String? = null

    var rank: Int = 0                // 稀有度

    // @JsonProperty("class_id")
    var classId: Int
        get() {
            return Class?.index ?: ServantClass.None.index
        }
        set(value) {
            classId = value
            for (c in ServantClass.values()) {
                if (c.index == value) {
                    Class = c
                    break
                }
            }
        }

    @JsonIgnore
    var Class: ServantClass? = null  // 职阶

    // 能力
    @JsonProperty("hp")
    var hpInit: Int = 0            // 初始HP

    @JsonProperty("atk")
    var atkInit: Int = 0           // 初始攻击

    var cost: Int = 0

    @JsonProperty("card_amount_quick")
    var cardAmountQuick: Int = 0   // 绿卡数量

    @JsonProperty("card_amount_arts")
    var cardAmountArts: Int = 0    // 蓝卡数量

    @JsonProperty("card_amount_buster")
    var cardAmountBuster: Int = 0  // 红卡数量

    @JsonIgnore
    var skillId1: String? = null
    @JsonIgnore
    var skillId2: String? = null
    @JsonIgnore
    var skillId3: String? = null
    @JsonIgnore
    var abilityId1: String? = null
    @JsonIgnore
    var abilityId2: String? = null
    @JsonIgnore
    var abilityId3: String? = null
    @JsonIgnore
    var abilityId4: String? = null
    @JsonIgnore
    var npId: String? = null

    @JsonProperty("skill_1")
    var skill1: SkillMetadata? = null
    @JsonProperty("skill_2")
    var skill2: SkillMetadata? = null
    @JsonProperty("skill_3")
    var skill3: SkillMetadata? = null     // 持有技能

    @JsonProperty("ability_1")
    var ability1: AbilityMetadata? = null
    @JsonProperty("ability_2")
    var ability2: AbilityMetadata? = null
    @JsonProperty("ability_3")
    var ability3: AbilityMetadata? = null
    @JsonProperty("ability_4")
    var ability4: AbilityMetadata? = null // 职介技能

    var np: NoblePhantasmMetadata? = null // 宝具

    // 资料
    var strength: String? = null         // 筋力
    var endurance: String? = null        // 耐久
    var agility: String? = null          // 敏捷
    var mana: String? = null             // 魔力
    var luck: String? = null             // 幸运
    @JsonProperty("np_rank")
    var npRank: String? = null           // 宝具

    var illustrator: String? = null      // 画师

    @JsonProperty("cv")
    var castVoice: String? = null        // 声优

    @JsonProperty("char_detail")
    var characterDetail: String? = null  // 角色详细

    @JsonProperty("story_1")
    var storyPart1: String? = null       // 羁绊故事1

    @JsonProperty("story_2")
    var storyPart2: String? = null       // 羁绊故事2

    @JsonProperty("story_3")
    var storyPart3: String? = null       // 羁绊故事3

    @JsonProperty("story_4")
    var storyPart4: String? = null       // 羁绊故事4

    @JsonProperty("story_5")
    var storyPart5: String? = null       // 羁绊故事5

    @JsonProperty("story_final")
    var storyFinal: String? = null       // 最终故事

    // 非面板数值
    var properties: MutableList<String>? = null // 特性

    var camp: String? = null
    var crit: Double = 0.0               // 掉星率
    var death: Double = 0.0              // 即死率

    // 暴击星分配
    @JsonProperty("star_assign")
    var starAssign: Int? = 0

    // NP获得量
    @JsonProperty("np_gain_quick")
    var npGainQuick: Double? = 0.0

    @JsonProperty("np_gain_arts")
    var npGainArts: Double? = 0.0

    @JsonProperty("np_gain_buster")
    var npGainBuster: Double? = 0.0

    @JsonProperty("np_gain_ex")
    var npGainEx: Double? = 0.0

    @JsonProperty("np_gain_np")
    var npGainNp: Double? = 0.0

    @JsonProperty("np_gain_damage")
    var npGainDamage: Double? = 0.0

    @JsonProperty("hit_quick")
    var hitQuick: Int? = 0

    @JsonProperty("hit_arts")
    var hitArts: Int? = 0

    @JsonProperty("hit_buster")
    var hitBuster: Int? = 0

    @JsonProperty("hit_ex")
    var hitEx: Int? = 0

    override fun toString(): String {
        return "No." + id + " " + nameChinese
    }
}
